use clap::{Parser, ValueEnum};

#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct Cli {
    #[arg(short, long, default_value_t = String::from("0.0.0.0"))]
    pub ip: String,

    #[arg(short, long, default_value_t = 6666)]
    pub port: u16,

    #[arg(short, long, value_enum)]
    pub command: String,

    #[arg(short, long, default_value_t = String::from("test"))]
    pub topic: String,

    #[arg(long, default_value_t = 0)]
    pub partitions: u16,

    #[arg(short, long, default_value_t = 1)]
    pub replication_factor: u16,

    #[arg(short, long, default_value_t = 0)]
    pub from_beginning: u16,

    #[arg(short, long, default_value_t = 0)]
    pub offset: usize,

    #[arg(short, long, default_value_t = String::from("default"))]
    pub group: String,

    #[arg(short, long, default_value_t = 10)]
    pub len: usize,
}

#[derive(Debug, Clone, Copy, ValueEnum)]
pub enum Command {
    None,
    CreateTopic, //创建 Topic
    List,
    Describe,
    Alter,
    GetOffset,
    DeleteTopic,
    Produce,
    Consume,
    DeleteGroup,
    Pull,
}
